/*******************************************************************************
 * Copyright (c) 2007 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.extensionpoints.transformation.dialog;

import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

import com.cea.papyrus.extensionpoints.transformation.definition.Group;
import com.cea.papyrus.extensionpoints.transformation.definition.Transformation;

/**
 * Label provider for transformations
 */
public class TransformationLabelProvider extends LabelProvider {

	/* (non-Javadoc)
	 * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
	 */
	@Override
	public String getText(Object element) {
		if (element instanceof Transformation) {
			return ((Transformation) element).getName();
		} else if (element instanceof Group) {
			return ((Group) element).getName();			
		}
		return null;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
	 */
	@Override
	public Image getImage(Object element) {
		if (element instanceof Transformation) {
			return ((Transformation) element).getImage();
		} else if (element instanceof Group) {
			return ((Group) element).getIcon();	
		}
		return null;
	}
}

